< previous page page_37 next page >

Page 37
Click the Start button on the Visual Basic toolbar.
Choose Run, Start.
Press F5.
0037-01.jpg
Figure 2.19
Entering the code to calculate the monthly payment
completes the 
Click event procedure for cmdCalculate.
When you execute the Start command, Visual Basic compiles your program to check for certain types of errors. If none are found, the program will begin executing, and you'll see the main form. Notice in Visual Basic's title bar that you've gone from Design mode to Run mode, meaning that the program is actually running. Because the application is object-oriented and event-driven, it's waiting for you (the user) to cause an event to occur to an object, such as typing in a text box or clicking a button.
Test your program by entering values for the principal, term, and interest rate. Use these values for your first test:
Principal
128000
Interest Rate
9.75
Term
30

After entering these values, click the Calculate Payment button. The monthly payment displayed should be 1099.72 (see Figure 2.20).
note.gif Because this program is a demonstration of basic programming techniques, its interface is quite simple, and very little effort has gone into making it error-proof. Numbers must be typed without thousands separators or dollar signs in order for the calculations to work properly. As you develop your programming skills later in the book, you'll see how to overcome these types of limitations. square.gif

 
< previous page page_37 next page >